const resultEnum = require('../utils/resultEnum').ResultEnum;
const Mock = new(require('../utils/mock')).Mocks();

/* 查询每日一拍图信息 */
function selectAuctionImgInfo(ctx, next) {
  try {
    const params = {
      ...ctx.query
    };
    console.log(params);
    ctx.success(resultEnum.GET_SUCCESS.code, resultEnum.GET_SUCCESS.msg, Mock.getAuctionImgList())
  } catch (error) {
    ctx.error(resultEnum.GET_ERROR.code, resultEnum.GET_ERROR.msg)
  }
}

/* 查询预展信息 */
function selectPreviewProductInfo(ctx, next) {
  try {
    const params = {
      ...ctx.query
    };
    console.log(params);
    console.log(Number(params.current) >= 6);
    if (Number(params.current) >= 6) {
      ctx.success(resultEnum.GET_SUCCESS.code, resultEnum.GET_SUCCESS.msg, Mock.getBlankInfo())
    } else {
      ctx.success(resultEnum.GET_SUCCESS.code, resultEnum.GET_SUCCESS.msg, Mock.getPriviewProductInfo())
    }
  } catch (error) {
    ctx.error(resultEnum.GET_ERROR.code, resultEnum.GET_ERROR.msg)
  }
}

module.exports = {
  selectAuctionImgInfo,
  selectPreviewProductInfo
}